import Vue from 'vue'
import Router from 'vue-router'
import Index from '../views/index'
import Register from '../views/register'
import Login from '../views/login'
import LoginAfterIndex from '../views/loginAfterIndex'
import MyTeam from '../views/myTeam'
import CreateTeam from '../views/createTeam'
import TeamInformation from '../views/teamInformation'
import InvitePlayer from '../views/invitePlayer'
import EntryTeamReq from '../views/entryTeamReq'

//防止重复切换同一个路由报红问题
const originalPush = Router.prototype.push

Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      component: Index,
      children:[


      ],

    },

    {
      path: '/register',
      component: Register
    },

    {
      path: '/login',
      component: Login
    },

    {
      path: '/loginAfterIndex',
      component: LoginAfterIndex,
      name: LoginAfterIndex
    },

    {
      path: '/myTeam',
      component: MyTeam,
      children:[
        {
          path: '/createTeam',
          component: CreateTeam
        },

        {
          path: '/teamInformation',
          component: TeamInformation
        },

        {
          path: '/invitePlayer',
          component: InvitePlayer
        },

        {
          path: '/entryTeamReq',
          component: EntryTeamReq
        }

      ],
    }



  ]
})
